package com.hackordie.operations.deletes;

import com.hackordie.commons.HackOrDieResult;
import com.hackordie.exceptions.HackOrDieException;
import com.hackordie.operations.AHackOrDieOperationAuth;

public class DeleteUser extends AHackOrDieOperationAuth {

	private final int id;
	private final String username;

	public DeleteUser(int id) {
		super();
		this.id = id;
		this.username = null;
	}

	public DeleteUser(String username) {
		super();
		this.id = -1;
		this.username = username;
	}

	@Override
	protected boolean checkParameters() {
		// TODO Auto-generated method stub
		return true;
	}

	@Override
	protected HackOrDieResult executeOperation() throws HackOrDieException {
		if (username != null) {
			userDao.delete(username);
		} else {
			userDao.delete(id);
		}
		return result;
	}

}
